1. Field of the Invention
The present invention relates to an information processing apparatus, an information processing method, and a program and, more particularly, to an information processing apparatus, an information processing method, and a program that are configured to make the insert edition of variable-length encoded data be successful without fail.
2. Description of the Related Art
With related-art VTRs (Video Tape Recorders), an insert editing technique for inserting edit data into a predetermined range of the data already recorded on a video tape (this data will be hereafter referred to as base data) is frequently used in general (see PCT Patent Publication No. WO99/22374).
An insert editing function similar to related-art technologies is also required by an editing system for editing base data variable-length encoded by an MPEG (Moving Picture Experts Group phase) algorithm having a long GOP (Group Of Picture) structure (hereafter referred to as a long-GOP-structured MPEG algorithm) recorded on a recording media.
In order to replace a part of an MPEG2 (Moving Picture Experts Group phase 2) stream and establish the replaced stream also as an MPEG2 stream, it is required for a total code amount of replacing data to be lower a total code amount of the base data to be replaced. In addition, it is required to connect a VBV occupation amount at a stream connection point.
When base data and replacing data match each other in frame rate, bit rate, and VBV occupation amount at stream connection point, a total generated code amount in a re-encode range of the base data comes to match with a total generated code amount of the replacing data.
Referring to FIG. 1, there is shown a graph indicative of temporal changes of VBV occupation amounts before and after the editing when a stream can be established also after the editing.
It should be noted that, in FIG. 1, the horizontal axis is representative of time while the vertical axis is representative of a bit occupation amount in a VBV (Video Buffering Verifier) buffer that is a virtual buffer corresponding to an input buffer of a decoder (hereafter referred to as a VBV occupation amount). This holds true with FIG. 2 through FIG. 6, FIG. 10, FIG. 11, FIG. 18 through FIG. 20, and FIG. 25.
In addition, in FIG. 1, dashed lines are indicative of temporal changes of the VBV occupation amount of base data while solid lines are indicative of temporal changes of the VBV occupation amount of replacing data (or overwrite data). Therefore, the slant of each oblique dashed line and each oblique solid line is indicative of a bit rate of each frame (or picture) while the length of each vertical dashed line and each vertical solid line is indicative of a generated code amount of each frame. This holds true with FIG. 2, FIG. 6, FIG. 10, and FIG. 11.
Meanwhile, with an MPEG2 stream, the bit rate is stored in a sequence layer, a value of the bit rate being rounded off to 400. Hence, it can be hardly said that the bit rate obtained from the sequence layer has a bit precision. Further, the bit rate obtained from the sequence layer is nothing but one that specifies the maximum bit rate of each MPEG2 stream.
Besides, the bit rate of each frame is defined by equation (1) below:
                              R          ⁡                      (            n            )                          =                              d            ⁡                          (              n              )                                            (                                          τ                ⁡                                  (                  n                  )                                            -                              τ                ⁡                                  (                                      n                    +                    1                                    )                                            +                              t                ⁡                                  (                                      n                    +                    1                                    )                                            -                              t                ⁡                                  (                  n                  )                                                      )                                              (        1        )            
It should be noted that, in equation (1) above, R(n) is representative of a bit rate of frame n and d(n) is representative of a code amount of frame n. τ(n) is representative of VBV delay of frame n that is a time from the input of a picture start code into the VBV buffer to the start of decoding. t(n) is representative of a time at which the picture of frame n is removed from the VBV buffer.
However, equation (1) above uses the VBV delay that is a value obtained by rounding off a VBV occupation amount. In addition, equation (1) above generates a rounding error caused by division. Thus, equation (1) above has a factor of causing an error.
With systems of which bit rates are specified by guidelines or the like, the bit rates computed on the basis of equation (1) above are often outside specification values.
For these reasons, the bit rate of the base data to be replaced becomes smaller than the bit rate of replacing data and therefore the code amount of the replacing data exceeds the code amount of the base data to be replaced as shown in FIG. 2, thereby making the editing fail. It should be noted that, in FIG. 2, each thick line is indicative of an excess part of the code amount of replacing data.
So, a method is considered in which the ratio of successful editing is achieved by variable-length encoding the replacing data with a bit rate low enough than base data. However, this method obviously leads to a deteriorated picture quality. In addition, because the correct bit rate of base data is not clear until the editing processing is started, this method is not considered to be effective.
Another method is also considered in which variable-length encoding is executed by completely matching the code amount distribution of replacing data with that of base data. However, this method causes the code amount distribution of replacing data to be influenced by that of base data, resulting in picture quality deviations. In addition, the complete match in code amount distribution between replacing data and base data requires the use of a part of code amount for stuffing data, also resulting in picture quality deterioration.
On the other hand, in order to replace a part of an MPEG2 stream and establish the replaced MPEG2 stream as it is after the replacement, the continuity of VBV occupation amount must be maintained.
However, the VBV occupation amount immediately before each picture is removed from the VBV buffer is quantized to be stored as a VBV delay, so that the VBV occupation amount has an error. It should be noted that the VBV occupation amount is defined by equation (2) below.0(n)=R(n)=τ(n)/90000+header(n)  (2)
In equation (2) above, 0(n) is indicative of a VBV occupation amount of frame n and R(n) is indicative of a bit rate of frame n. τ(n) is indicative of a VBV delay of frame n and header(n) is indicative of the number of bits up to a picture start code of frame n. FIG. 3 shows a relationship of equation (2).
As described above, because a VBV occupation amount has an error, even executing variable-length encoding so as to comply with the VBV buffer restrictions at the time of editing may actually cause an overflow or underflow of the VBV buffer by the error.
Referring to FIG. 4 and FIG. 5, there are shown examples of VBV buffer failures due to an error in VBV occupation amount (hereafter referred to as an occupation amount error).
It should be noted that solid lines are indicative of the temporal changes of the VBV occupation amount of replacing data with the occupation amount error being 0 and the thick lines are indicative of the temporal changes of the VBV occupation amount of replacing data with the occupation amount error being a maximum.
As shown in FIG. 4, if encoding is executed so as for the VBV occupation amount of replacing data to comply with the restrictions of the VBV buffer, then no overflow occurs if the occupation amount error is 0; however, an overflow may occur if an upward occupation amount error occurs in the start picture in a re-encoding range. Likewise, as shown in FIG. 5, an underflow may occur if a downward occupation amount error occurs in the start picture in the re-encoding range.
With reference to FIG. 4 and FIG. 5, the influence of the occupation amount error of the start picture in the re-encoding range of base data was described. In the case of an occupation amount error of a picture (hereafter referred to as a VBV occupation amount target picture) next to the last picture in the re-encoding range of base data, the influence of this occupation amount error may also cause an underflow or an overflow.
Further, in the inserting editing of an MPEG stream recording on a recording media, replacing data must be stored in the recording area of base data without failure. If the correct bit rate of base data and the VBV occupation amount having bit precision are known, then connecting the VBV occupation amount at a stream point matches the total code amount of the base data to be replaced with the total code amount of the replacing data.
However, in the case where the VBV occupation amount converted from the VBV delay is used for the VBV occupation amount of base data, an error occurs in the code amounts before and after the editing by an occupation amount error difference between the start picture of the re-encoding range and the VBV occupation amount target picture as shown in FIG. 6. Consequently, the total code amount of replacing data exceeds the total code amount of the base data to be replaced, thereby disabling the storage of the replacing data into recording area of this base data.